<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=$da['title']?></title>
<link rel="stylesheet" type="text/css" href="res/css/css.css"/>
<script type="text/javascript" src="res/js/jquery.js"></script>
<script type="text/javascript" src="res/js/js.js"></script>
<script type="text/javascript" src="res/js/base64-min.js"></script>
<script type="text/javascript" src="res/js/nwjs.js"></script>
<link rel="shortcut icon" href="favicon.ico" />
<style>
.lmaisft{width:450px;border-radius:10px;text-align:left; background:rgba(0,0,0,0.1);border:0px #dddddd solid;}
.box{box-shadow:0px 5px 15px 1px rgba(0,0,0,0.05);}
.btn-danger{background-color:#d9534f;}
<?php
$col = getconfig('apptheme','#336699');
echo 'body{--main-color:'.$col.'}';
?>
</style>
<script>
function initbody(){
	form('rockofficeuser').value = js.getoption('lguser');
	getpassobj().val(js.getoption('lgpass'));
	changepass();
	var fac = js.getoption('lgface');
	if(fac)get('imglogo').src = fac;
	var aud = js.getoption('lgautodl');
	if(aud=='yes'){
		get('autologin').checked=true;
		if(form('rockofficeuser').value && getpassobj().val()){
			autologins(3);
		}
	}
	resizewh();
	$(window).resize(resizewh);
	nwjs.init();
	if(js.request('tform')=='main')rewinheight(380,400);
	
	if(nwjsgui){
		$('#msgview').html('<a class="zhu" onclick="return clearchater()" href="javascript:;">清缓存</a>');
	}
}
function changepass(){
	var pass = getpassobj().val();
	var len = pass.length,str='';
	for(var i=1;i<=len;i++)str+='*';
	$('#passinputs').val(str);
}
function clearchater(){
	nwjsgui.App.clearCache();
	localStorage.clear();
	var na = nwjsgui.App.manifest.name;
	js.confirm('基本缓存已删除，更多缓存删除，是否打开对应['+na+']目录？需手动全部删除目录。',function(jg){
		if(jg=='yes'){
			var naea = nwjsgui.App.dataPath;
			var oru= naea.split(na)[0]+na;
			nwjsgui.Shell.openItem(oru);
			nwjsgui.App.quit();
		}
	});
}
function getpassobj(){
	return $('input[type=password]');
	return $('#passinput');
}
function loginsubmit(){
	var user = form('rockofficeuser').value,pass=getpassobj().val();
	if(!user){
		js.setmsg('请输入用户名');return;
	}
	if(!pass){
		js.setmsg('请输入密码');return;
	}
	js.setmsg('登录中...');
	var odg = form('button');
	js.setoption('lguser', user);
	js.setoption('lgpass', pass);
	js.setoption('lgautodl', get('autologin').checked ? 'yes':'');
	odg.disabled=true;
	js.ajax({
		url:'?m=login&a=logincheck',data:{user:user,pass:pass,device:device,cform:'client'},
		type:'post',
		dataType:'json',
		success:function(ret){
			if(!ret.success){
				odg.disabled=false;
				js.setmsg(ret.msg);
			}else{
				js.setoption('lgface', ret.data.face);
				get('imglogo').src = ret.data.face;
				js.setoption('admintoken', ret.data.token);
				js.setmsg('登录成功跳转中','green');
				$('#maindiv').hide();
				var burl = burl= '?d=reim&m=index';
				rewinheight(620, 950);
				js.location(burl);
			}
		}
	});
}

function resizewh(){
	var h = ($(document).height()-360)*0.5;
	$('#topheih').css('height',''+h+'px');
}

function rewinheight(hei, wid){
	if(!nwjsgui)return;
	var l = (screen.width-wid)*0.5;
	var t = (screen.height-hei)*0.5-20;
	nwjs.win.moveTo(parseInt(l),parseInt(t));
	nwjs.win.resizeTo(wid,hei);
}
function autologins(ms){
	if(!get('autologin').checked){
		js.setmsg();
		return;
	}
	if(ms==0){
		loginsubmit();
		return;
	}
	js.setmsg(''+ms+'秒后自动登录','gray');
	setTimeout('autologins('+(ms-1)+')',1000);
}
function blurpass(o1){
	var val = o1.value;
	
}
</script>
</head>


<body style="background:#f2f3f5;">

<div align="center" style="width:100%">
	<div id="topheih" class="blank40"></div>


	
	<div id="maindiv" class="">
		
		<div  align="center"><img title="<?=URL?>" class="box" onclick="location.reload()" style="border-radius:50%;border:0px #ffffff solid; background:white" src="images/logo.png" id="imglogo" align="absmiddle" height="100" width="100"><b style="font-size:22px"></b></div>
		<div class="blank10"></div>
		
		<div align="center">
		<form style="padding:10px;width:250px" align="left" name="myform">	
			<div>
				<div><input type="text" style="height:40px;width:100%;border-radius:5px" class="input" onKeyUp="if(event.keyCode==13)getpassobj().focus()" value=""  placeholder="请输入帐号/手机号" name="rockofficeuser" ></div>
			</div>

			<div class="blank20"></div>
			<div>
				<div>
				<input  style="height:40px;width:100%;border-radius:5px" class="input" onKeyUp="if(event.keyCode==13)loginsubmit()" value="" type="password" placeholder="请输入密码">
				
				</div>
			</div>
			<div class="blank10"></div>	
			

			<div align="left"><label><input type="checkbox" id="autologin">下次自动登录</label><?php 
			if(getconfig('regbool'))echo '&nbsp;<a class="zhu" href="?m=login&a=reg">注册</a>';
			?>&nbsp;<a href="?m=login&a=find"  class="zhu">忘记密码？</a></div>
			<div class="blank20"></div>

			<div align="left">
				<button type="button" onclick="loginsubmit()" style="padding:10px 30px;border-radius:5px;width:100px" class="webbtn" name="button">登录</button>&nbsp;<span id="msgview"></span>
			</div>
		</form>	
		</div>
		
	</div>


</div>
</body>
</html>